@extends('master')

@section('content')
<div class="management-content">
    <div class="container">
        <div class="record-list">
          @if(Session::get('errors'))
		   <div class="alert alert-danger">
			   {{ $errors->first() }}
		   </div>
		   @endif

           @if(Session::get('message'))
          <div class="alert alert-info" role="alert">{{ Session::get('message') }}</div>
           @endif

           @if(Session::get('error'))
          	<div class="alert alert-danger" role="alert">
          		<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
          		<p>{{ Session::get('error') }}</p>
          		@if(Session::get('confirm'))
          		<p><a href="/user/confirm-delete/{{ Session::get('userInfo')->id }}" class="btn btn-danger">确认</a></p>

          		@endif
          	</div>
           @endif

            <h2>用户管理</h2>
            <table class="table">
                <thead>
                    <tr>
                        <th>用户名</th>
                        <th>邮箱</th>
                        <th>角色</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                     @foreach ($users as $user)
                    <tr>
                        <td>
							{{ $user->username }}
                        </td>
                        <td>
                            {{ $user->email }}
                        </td>
                        <td>
                            {{ $user->role }}
                        </td>
                        <td>
                            <a href="javascript:void(0)" class="btn btn-sm btn-primary" data-remote="/user/edit/{{ $user->id }}" data-toggle="modal" data-target="#user-edit-modal"><i class="glyphicon glyphicon-edit"></i> 编辑</a>
                            <a href="/user/delete/{{ $user->id }}" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-trash"></i> 删除</a>
                        </td>
                    </tr>
                     @endforeach


                </tbody>
            </table>



            {{ $users->links() }}
        </div>

    </div>
</div>

<div class="modal fade" id="user-edit-modal" tabindex="-1" role="dialog" aria-labelledby="User Details" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">

		</div>
	</div>
</div>


@stop




